﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using _MetalSlug.Soldiers.Units;
using _MetalSlug.Weapons.Units;

namespace _MetalSlug.Weapons.Factory
{
    public class BulletStore
    {
        static BulletStore Instance;
        List<Bullet> bullets;

        public List<Bullet> Bullets
        {
          get { return bullets; }
          set { bullets = value; }
        }

        protected BulletStore()
        {
            Bullets = new List<Bullet>();
            Bullets.Add(new MiniGunBullet(Vector2.Zero, Vector2.Zero, new Vector2(500, 500)));
            Bullets.Add(new ShotGunBullet(Vector2.Zero, Vector2.Zero, new Vector2(500,500)));
            Bullets.Add(new AKBullet(Vector2.Zero, Vector2.Zero, new Vector2(500,0)));
            Bullets.Add(new BazokaBullet(Vector2.Zero, Vector2.Zero, new Vector2(400, 0)));
            Bullets.Add(new Boom(Vector2.Zero, Vector2.Zero, new Vector2(0, 400)));
            Bullets.Add(new BoomHeli(Vector2.Zero, Vector2.Zero, new Vector2(0, 400)));
        }

        public static BulletStore GetInstance()
        {
            if (Instance == null)
            {
                Instance = new BulletStore();
            }
            return Instance;
        }

        public Bullet Produce(Bullet.TYPE_BULLET Type)
        {
            for (int i = 0; i < Bullets.Count; i++)
            {
                if (Bullets[i].Type == Type)
                {
                    return Bullets[i].Clone();
                }
            }

            return null;
        }
    }
}
